<template>
	<view class="tNavBar">
		<uni-nav-bar :left-icon="back?'back':''" :left-text="back?backText:''" :title="title" statusBar :border="false"
			@clickLeft="leftEvent"></uni-nav-bar>
	</view>
</template>

<script setup lang="ts">
	const props = defineProps({
		title: {
			default: '',
			type: String
		},
		back: {
			default: false,
			type: Boolean
		},
		backText: {
			default: '返回',
			type: String
		},
		customLeftFnc: {
			default: null,
			type: Function
		}
	})

	// 左侧的事件
	const leftEvent = () => {
		console.log('props.customLeftFnc', props.customLeftFnc);
		if(!props.back) return;
		if (props.customLeftFnc) {
			return props.customLeftFnc();
		}

		uni.navigateBack(1);
	}
</script>

<style lang="scss">
	.tNavBar {}
</style>